Skip to contentSkip to conversation

Change in openvpn[master]: socket: Initialize struct in_addr_t in getaddr()

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Dec 8, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1765212547000.I999916f9561a638214b70cf43de78060e9e0e792@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email

to review the following change.

Change subject: socket: Initialize struct in_addr_t in getaddr()
......................................................................

socket: Initialize struct in_addr_t in getaddr()

We have false-positive "‘addr’ may be used uninitialized" warnings with MinGW 13.0.0 compiler. Work around them.

Change-Id I999916f9561a638214b70cf43de78060e9e0e792

---
M src/openvpn/socket.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1420/1

src/openvpn/socket.c +1 -1
index 80c2895..3e90833 100644
@@ -202,7 +202,7 @@
 getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded,
         struct signal_info *sig_info)
 {
-    in_addr_t addr;
+    in_addr_t addr = { 0 };
     int status;
 
     status = get_addr_generic(AF_INET, flags, hostname, &addr, NULL, resolve_retry_seconds,

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I999916f9561a638214b70cf43de78060e9e0e792
Gerrit-Change-Number: 1420
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email )

Change subject: socket: Initialize struct in_addr_t in getaddr()
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I999916f9561a638214b70cf43de78060e9e0e792
Gerrit-Change-Number: 1420
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 08 Dec 2025 17:03:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 socket: Initialize struct in_addr_t in getaddr()

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

We have false-positive "‘addr’ may be used uninitialized" warnings with MinGW 13.0.0 compiler. Work around them.

Change-Id I999916f9561a638214b70cf43de78060e9e0e792

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socket.c +1 -1
index 80c2895..3e90833 100644
@@ -202,7 +202,7 @@
 getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded,
         struct signal_info *sig_info)
 {
-    in_addr_t addr;
+    in_addr_t addr = { 0 };
     int status;
 
     status = get_addr_generic(AF_INET, flags, hostname, &addr, NULL, resolve_retry_seconds,
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: socket: Initialize struct in_addr_t in getaddr()

This is somewhat of a silly-compiler-syndrome - especially since the last warning in this area was a true positive, now the addition of the "if(ai)" clause - which has nothing whatsoever to do with the return data or not - causes a warning (that we treat fatal) in mingw, and only in the release builds...

But anyway, this is just a 32bit integer, not in the fast path, and initializing things is generally a good idea :-)

Tested with the (upcoming) GHA mingw+release builds that reproduceably fail without this change.

Your patch has been applied to the master branch.

commit e8dc7f35584df1f1cf920636cd5ac7232f0009a9

Author: Frank Lichtenheld
Date:   Mon Dec 8 18:03:13 2025 +0100
     socket: Initialize struct in_addr_t in getaddr()

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34894.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: socket: Initialize struct in_addr_t in getaddr()
......................................................................

socket: Initialize struct in_addr_t in getaddr()

We have false-positive "‘addr’ may be used uninitialized" warnings with MinGW 13.0.0 compiler. Work around them.

Change-Id I999916f9561a638214b70cf43de78060e9e0e792

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34894.html

---
M src/openvpn/socket.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/20/1420/2

src/openvpn/socket.c +1 -1
index 80c2895..3e90833 100644
@@ -202,7 +202,7 @@
 getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded,
         struct signal_info *sig_info)
 {
-    in_addr_t addr;
+    in_addr_t addr = { 0 };
     int status;
 
     status = get_addr_generic(AF_INET, flags, hostname, &addr, NULL, resolve_retry_seconds,

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I999916f9561a638214b70cf43de78060e9e0e792
Gerrit-Change-Number: 1420
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email )

Change subject: socket: Initialize struct in_addr_t in getaddr()
......................................................................

socket: Initialize struct in_addr_t in getaddr()

We have false-positive "‘addr’ may be used uninitialized" warnings with MinGW 13.0.0 compiler. Work around them.

Change-Id I999916f9561a638214b70cf43de78060e9e0e792

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1420
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34894.html

---
M src/openvpn/socket.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/socket.c +1 -1
index 80c2895..3e90833 100644
@@ -202,7 +202,7 @@
 getaddr(unsigned int flags, const char *hostname, int resolve_retry_seconds, bool *succeeded,
         struct signal_info *sig_info)
 {
-    in_addr_t addr;
+    in_addr_t addr = { 0 };
     int status;
 
     status = get_addr_generic(AF_INET, flags, hostname, &addr, NULL, resolve_retry_seconds,

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1420?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I999916f9561a638214b70cf43de78060e9e0e792
Gerrit-Change-Number: 1420
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>